function getReaderCardList() {
    $.ajax({
        url : '/admin/getReaderCardList',
        type : 'POST',
        success : function (cardList) {
            var tbody = document.querySelector("#datatables tbody");
            tbody.innerHTML = "";
            var rows = cardList.map(function (card) {
                return `
            <tr>
                <td>${card.jsId || ""}</td>
                <td>${card.period || ""}</td>
                <td>${card.readId || ""}</td>
            </tr>
        `;
            });
            tbody.innerHTML = rows.join("");
        },
        error : function () {
            alert("请求出错");
        }
    })
}

$("#showPopup").click(function () {
    $("#inputreadId").val("");

})

$("#btn-delete").click(function(event) {
    event.preventDefault();
    $.ajax({
        url: "/admin/deleteReaderCard",
        type: "POST",
        data: {
            readId: $("#inputreadId").val(),
        },
        success: function (res) {
            if (res === "success") {
                alert("删除成功");
                getReaderCardList();
            } else {
                alert("删除失败");
            }
        },
        error: function () {
            alert("请求出错");
        }
    });
});